# Maintainer: Andrzej Giniewicz <gginiu@gmail.com>
# Maintainer: Bruno Pagani <archange@archlinux.org>
# Contributor: Michael Schubert <mschu.dev at gmail>
# Contributor: Panagiotis Mavrogiorgos (pmav99) <> (gmail)

pkgname=python-bottleneck
pkgver=1.3.7
pkgrel=2
pkgdesc="Fast NumPy array functions written in Cython"
arch=(loong64 x86_64)
url="https://github.com/kwgoodman/bottleneck"
license=(BSD)
depends=(python-numpy)
makedepends=(python-setuptools)
checkdepends=(python-pytest)
#source=(${url}/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz)
source=($pkgname-$pkgver.tar.gz::${url}/archive/refs/tags/v${pkgver}.tar.gz) # https://bugs.archlinux.org/task/77683
sha256sums=('12bd41b798b752d579d062b932aea4acc8a13729983b43ae7fcae1a0ec110c87')

build() {
  cd bottleneck-${pkgver}
  python setup.py build
}

check() {
  cd bottleneck-${pkgver}
  python -m venv --system-site-packages test-env
  test-env/bin/python setup.py install --skip-build
  test-env/bin/python /usr/bin/pytest -vv --color=yes --pyargs bottleneck
}

package() {
  cd bottleneck-${pkgver}
  python setup.py install --skip-build --root="${pkgdir}" --optimize=1
  install -Dm644 LICENSE -t "${pkgdir}"/usr/share/licenses/${pkgname}/
}
